package com.ostrich.a2104shopping.ui.home.viewmodel;

import com.ostrich.a2104shopping.ui.home.HomeRepository;
import com.ostrich.a2104shopping.ui.home.entity.CategoryEntity;
import com.ostrich.a2104shopping.ui.home.entity.GoodsEntity;
import com.ostrich.lib_common.net.BaseResponseEntity;

import java.util.List;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

public class HomeViewModel extends ViewModel {
    private HomeRepository mHomeRepository = new HomeRepository();
    public LiveData<BaseResponseEntity<List<CategoryEntity>>> category(){
        return mHomeRepository.category();
    }

    public LiveData<BaseResponseEntity<List<GoodsEntity>>> info(int category_id, int currentPage, int pageSize){
        return mHomeRepository.info(category_id,currentPage,pageSize);
    }

    public void insertAll(List<GoodsEntity> list){
        mHomeRepository.insertAll(list);
    }


    public List<GoodsEntity>  select(String keywords){
        return mHomeRepository.select(keywords);
    }

}